# -*- coding: utf-8 -*-
# @Time : 2021/9/17 14:26
# @Author : Mr  jelis
# @Email : 1402615849@qq.com
# @File : mid_autumn_page.py
# @Project : mryx_test
"""促销活动主页页面类"""
from appium.webdriver.common.mobileby import MobileBy as By
from page.base_page import BasePage
from utils.swipe import Swipe
class MidAutumn(BasePage):
    """定义定位器"""
    shangping_locator=(By.XPATH,'/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/'
                                'android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/'
                                'android.widget.FrameLayout[2]/android.widget.FrameLayout/android.widget.LinearLayout/'
                                'android.widget.FrameLayout/android.webkit.WebView/android.webkit.WebView/android.view.View/'
                                'android.view.View[3]/android.view.View[1]/android.view.View[2]')
    add_shopping_locator=(By.XPATH,'//android.widget.FrameLayout[1]/android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.LinearLayout[1]/android.widget.FrameLayout[2]/android.widget.FrameLayout[1]/android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.webkit.WebView[1]/android.webkit.WebView[1]/android.view.View[1]/android.view.View[3]/android.view.View[1]/android.view.View[2]/android.view.View[5]/android.view.View[1]/android.widget.Image[2]')
    enter_shopping_locator = (By.XPATH, '//android.widget.Image[@text=\"SGVyMhtyy50c20Y96QmlSgEb\"]')
    def shangping(self):
        """进入商品详情页"""
        self.driver.find_element(*self.shangping_locator).click()
    def add_shopping(self):
        """加入购物车"""
        self.driver.find_element(*self.add_shopping_locator).click()
    def enter_shopping(self):
        """进入购物车"""
        self.driver.find_element(*self.enter_shopping_locator).click()